package com.book.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.book.pojo.Readers;
import com.book.pojo.Signin;
import com.book.mapper.SigninDao;
import com.book.service.SigninService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fk
 * @since 2023-10-12 17:37:48
 */
@Service
public class SigninServiceImpl extends ServiceImpl<SigninDao, Signin> implements SigninService {

    @Autowired
    private SigninDao signinDao;

    @Override
    public List<Signin> getById(Long userId) {
        QueryWrapper<Signin> dqw = new QueryWrapper<>();
        dqw.eq("reader_id",userId);
        return signinDao.selectList(dqw);
    }

    @Override
    public int addById(Long readerId) {
        Signin signin = new Signin();
        Signin signin1 = signin.setReaderId(readerId);
        return signinDao.insert(signin1);
    }

}
